package org.niit.spark

import org.apache.spark.{SparkConf, SparkContext}

object PopularTeacher {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setMaster("local[*]").setAppName("PopularTeacher")
    val sc = new SparkContext(conf)
    val file = sc.textFile("D:\\DNIIT\\teacher.log")
    file.flatMap(_.split(",")).map((_, 1)).reduceByKey(_ + _)
      .sortBy(_._2, false)
      .take(1).foreach(println(_))
  }

}
